//Accepted
#include <cstdio>

int main(){
	int t, x, y;
	scanf("%d", &t);
	while(t--){
		scanf("%d%d", &x, &y);
		printf("%s\n", x<y?"NO BRAINS":"MMM BRAINS");
	}
	return 0;
}